package com.health.security;

import lombok.extern.slf4j.Slf4j;
import org.springframework.security.core.Authentication;
import org.springframework.security.web.authentication.logout.LogoutSuccessHandler;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @Classname CustomLogoutSuccessHandler
 * @Description TODO
 * @Version 1.0.0
 * @Date 2023/3/28 11:02
 * @Author RainGrd
 */
@Slf4j
public class CustomLogoutSuccessHandler implements LogoutSuccessHandler {


    @Override
    public void onLogoutSuccess(HttpServletRequest httpServletRequest, HttpServletResponse response, Authentication authentication) throws  IOException {
        log.info("注销成功!");
        //重定向到登录页面
        response.sendRedirect("/login.html");
    }
}
